package com.dt.app.modules.product.vo;

import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Locale;

import com.dt.app.modules.base.entites.PageEntity;
/**
 * <p>
 * 
 * </p>
 *
 * @author 鸿源塔基
 * @since 2024-03-07
 */
@Data
@NoArgsConstructor
@ApiModel(value="ProductMedia对象", description="")
public class ProductMediaBean extends PageEntity implements Serializable {

    private static final long serialVersionUID=17678609967L;

    @ApiModelProperty(value = "产品图片")
    private Long productMediaId;

    @ApiModelProperty(value = "产品")
    private Integer productId;

    @ApiModelProperty(value = "排序")
    private Integer seq;

    @ApiModelProperty(value = "路径")
    private String url;

    @ApiModelProperty(value = "说明")
    private String msg;

    @ApiModelProperty(value = "根据路径类型")
    private Integer mtype;

    public void toInitType(){
        if(url==null)return;
        String ts=url.toLowerCase(Locale.ROOT);
        if(ts.endsWith(".jpg")||ts.endsWith(".png")||ts.endsWith(".gif")||ts.endsWith(".jpeg")){
            mtype=1;
        }else if(ts.endsWith(".mp4")||ts.endsWith(".3gp")||ts.endsWith(".wmv")||ts.endsWith(".avi")
                ||ts.endsWith(".rm")||ts.endsWith(".rmvb")||ts.endsWith(".mov")){
            mtype=2;
        }else{
            mtype=1;
        }
    }
}
